package com.cogent.context;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.cogent.common.util.Globals;
import com.cogent.menu.cache.MenuCache;

public class InitParamContextLoaderListener implements ServletContextListener {

	public void contextDestroyed(ServletContextEvent arg0) {
		if(!Globals.getProperty("isdebuge").toLowerCase().equals("true"))
			MenuCache.clear();
	}

	public void contextInitialized(ServletContextEvent event) {
		String initPath = event.getServletContext().getRealPath("/") + event.getServletContext().getInitParameter("cogentConfigLocation");    
		Globals.SetRootPath(initPath);
		if(!Globals.getProperty("isdebuge").toLowerCase().equals("true"))
			MenuCache.init();
	}
}
